/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gob.inamhi.entidades;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author dhinojosa
 */
@Entity
@Table(name = "sist", schema="administrative")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Sist.findAll", query = "SELECT s FROM Sist s"),
    @NamedQuery(name = "Sist.findBySistId", query = "SELECT s FROM Sist s WHERE s.sistId = :sistId"),
    @NamedQuery(name = "Sist.findBySistnomb", query = "SELECT s FROM Sist s WHERE s.sistnomb = :sistnomb"),
    @NamedQuery(name = "Sist.findBySistdesc", query = "SELECT s FROM Sist s WHERE s.sistdesc = :sistdesc"),
    @NamedQuery(name = "Sist.findBySistuing", query = "SELECT s FROM Sist s WHERE s.sistuing = :sistuing"),
    @NamedQuery(name = "Sist.findBySistfing", query = "SELECT s FROM Sist s WHERE s.sistfing = :sistfing"),
    @NamedQuery(name = "Sist.findBySistumod", query = "SELECT s FROM Sist s WHERE s.sistumod = :sistumod"),
    @NamedQuery(name = "Sist.findBySistfmod", query = "SELECT s FROM Sist s WHERE s.sistfmod = :sistfmod")})
public class Sist implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "sist__id")
    private Integer sistId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "sistnomb")
    private String sistnomb;
    @Size(max = 100)
    @Column(name = "sistdesc")
    private String sistdesc;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "sistuing")
    private String sistuing;
    @Basic(optional = false)
    @NotNull
    @Column(name = "sistfing")
    @Temporal(TemporalType.TIMESTAMP)
    private Date sistfing;
    @Size(max = 20)
    @Column(name = "sistumod")
    private String sistumod;
    @Column(name = "sistfmod")
    @Temporal(TemporalType.TIMESTAMP)
    private Date sistfmod;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "sistId")
    private Collection<Metr> metrCollection;

    public Sist() {
    }

    public Sist(Integer sistId) {
        this.sistId = sistId;
    }

    public Sist(Integer sistId, String sistnomb, String sistuing, Date sistfing) {
        this.sistId = sistId;
        this.sistnomb = sistnomb;
        this.sistuing = sistuing;
        this.sistfing = sistfing;
    }

    public Integer getSistId() {
        return sistId;
    }

    public void setSistId(Integer sistId) {
        this.sistId = sistId;
    }

    public String getSistnomb() {
        return sistnomb;
    }

    public void setSistnomb(String sistnomb) {
        this.sistnomb = sistnomb;
    }

    public String getSistdesc() {
        return sistdesc;
    }

    public void setSistdesc(String sistdesc) {
        this.sistdesc = sistdesc;
    }

    public String getSistuing() {
        return sistuing;
    }

    public void setSistuing(String sistuing) {
        this.sistuing = sistuing;
    }

    public Date getSistfing() {
        return sistfing;
    }

    public void setSistfing(Date sistfing) {
        this.sistfing = sistfing;
    }

    public String getSistumod() {
        return sistumod;
    }

    public void setSistumod(String sistumod) {
        this.sistumod = sistumod;
    }

    public Date getSistfmod() {
        return sistfmod;
    }

    public void setSistfmod(Date sistfmod) {
        this.sistfmod = sistfmod;
    }

    @XmlTransient
    public Collection<Metr> getMetrCollection() {
        return metrCollection;
    }

    public void setMetrCollection(Collection<Metr> metrCollection) {
        this.metrCollection = metrCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (sistId != null ? sistId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sist)) {
            return false;
        }
        Sist other = (Sist) object;
        if ((this.sistId == null && other.sistId != null) || (this.sistId != null && !this.sistId.equals(other.sistId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gob.inamhi.entidades.Sist[ sistId=" + sistId + " ]";
    }
    
}
